summaryrefslogtreecommitdiffstats
path: root/src/BiomeDef.h
blob: 050c641d318aafd7e876d6c1df2d982607dc3c23 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160

// BiomeDef.h

// Defines relevant information and methods related to biomes





#pragma once





// tolua_begin
/** Biome IDs
The first batch corresponds to the clientside biomes, used by MineCraft.
BiomeIDs over 255 are used by Cuberite internally and are translated to MC biomes before sending them to client
*/
enum EMCSBiome
{
	biInvalidBiome     = -1,

	biFirstBiome       = 0,
	biOcean            = 0,
	biPlains           = 1,
	biDesert           = 2,
	biExtremeHills     = 3,
	biForest           = 4,
	biTaiga            = 5,
	biSwampland        = 6,
	biRiver            = 7,
	biHell             = 8,  // same as Nether
	biNether           = 8,
	biSky              = 9,  // same as biEnd
	biEnd              = 9,
	biFrozenOcean      = 10,
	biFrozenRiver      = 11,
	biIcePlains        = 12,
	biTundra           = 12,  // same as Ice Plains
	biIceMountains     = 13,
	biMushroomIsland   = 14,
	biMushroomShore    = 15,
	biBeach            = 16,
	biDesertHills      = 17,
	biForestHills      = 18,
	biTaigaHills       = 19,
	biExtremeHillsEdge = 20,
	biJungle           = 21,
	biJungleHills      = 22,

	// Release 1.7 biomes:
	biJungleEdge       = 23,
	biDeepOcean        = 24,
	biStoneBeach       = 25,
	biColdBeach        = 26,
	biBirchForest      = 27,
	biBirchForestHills = 28,
	biRoofedForest     = 29,
	biColdTaiga        = 30,
	biColdTaigaHills   = 31,
	biMegaTaiga        = 32,
	biMegaTaigaHills   = 33,
	biExtremeHillsPlus = 34,
	biSavanna          = 35,
	biSavannaPlateau   = 36,
	biMesa             = 37,
	biMesaPlateauF     = 38,
	biMesaPlateau      = 39,

	// Automatically capture the maximum consecutive biome value into biMaxBiome:
	biNumBiomes,  // True number of biomes, since they are zero-based
	biMaxBiome = biNumBiomes - 1,  // The maximum biome value

	// Add this number to the biomes to get the variant
	biVariant = 128,

	// Release 1.7 biome variants:
	biFirstVariantBiome    = 129,
	biSunflowerPlains      = 129,
	biDesertM              = 130,
	biExtremeHillsM        = 131,
	biFlowerForest         = 132,
	biTaigaM               = 133,
	biSwamplandM           = 134,
	biIcePlainsSpikes      = 140,
	biJungleM              = 149,
	biJungleEdgeM          = 151,
	biBirchForestM         = 155,
	biBirchForestHillsM    = 156,
	biRoofedForestM        = 157,
	biColdTaigaM           = 158,
	biMegaSpruceTaiga      = 160,
	biMegaSpruceTaigaHills = 161,
	biExtremeHillsPlusM    = 162,
	biSavannaM             = 163,
	biSavannaPlateauM      = 164,
	biMesaBryce            = 165,
	biMesaPlateauFM        = 166,
	biMesaPlateauM         = 167,
	// Automatically capture the maximum consecutive biome value into biVarientMaxBiome:
	biNumVariantBiomes,  // True number of biomes, since they are zero-based
	biMaxVariantBiome = biNumVariantBiomes - 1,  // The maximum biome value
} ;

// tolua_end





/** Hash for EMCSBiome, so that it can be used in std::unordered_map etc. */
struct BiomeHasher
{
public:
	std::size_t operator() (const EMCSBiome a_Biome) const
	{
		return static_cast<std::size_t>(a_Biome);
	}
};





// tolua_begin

/** Translates a biome string to biome enum. Takes either a number or a biome alias (built-in). Returns biInvalidBiome on failure. */
extern EMCSBiome StringToBiome(const AString & a_BiomeString);

/** Translates biome enum into biome string. Returns empty string on failure (unknown biome). */
extern AString BiomeToString(int a_Biome);

/** Returns true if the biome has no downfall - deserts and savannas */
extern bool IsBiomeNoDownfall(EMCSBiome a_Biome);

/** Returns true if the biome is an ocean biome. */
inline bool IsBiomeOcean(int a_Biome)
{
	return ((a_Biome == biOcean) || (a_Biome == biDeepOcean));
}

/** Returns true if the biome is very cold
(has snow on ground everywhere, turns top water to ice, has snowfall instead of rain everywhere).
Doesn't report mildly cold biomes (where it snows above certain elevation), use IsBiomeCold() for those. */
extern bool IsBiomeVeryCold(EMCSBiome a_Biome);

/** Returns true if the biome is cold
(has snow and snowfall at higher elevations but not at regular heights).
Doesn't report Very Cold biomes, use IsBiomeVeryCold() for those. */
extern bool IsBiomeCold(EMCSBiome a_Biome);

/** Returns true if the biome is a mountain type */
extern bool IsBiomeMountain(EMCSBiome a_Biome);

/** Returns the height when a biome when a biome starts snowing. */
extern int GetSnowStartHeight(EMCSBiome a_Biome);

// tolua_end